<template>
  <div class="shopInfo">
    <div class="shop-top">
      <img :src="shopInfo.logo" alt="">
      <span class="title">{{shopInfo.name}}</span>
    </div>
    <div class="shop-middle">
      <div class="shop-middle-item shop-middle-left">
        <div class="info-sell">
          <div class="sells-count">{{shopInfo.sells | sellCountFilter}} 万</div>
          <div class="sells-text">总销量</div>
        </div>
        <div class="info-goods">
          <div class="goods-count">{{shopInfo.goodsCount}}</div>
          <div class="goods-text">全部宝贝</div>
        </div>
      </div>
      <div class="shop-middle-item shop-middle-right">
        <div class="service">
          <div class="service-item" v-for="(item,index) in shopInfo.score" :key="index">
            <div class="item name">{{item.name}}</div>
            <div class="item score" :class="{'good' : item.isBetter}">{{item.score}}</div>
            <div class="item better" :class="{'good' : item.isBetter}">{{item.isBetter?'高':'低'}}</div>
          </div>
        </div>
      </div>
    </div>
    <div class="shop-bottom">
      <div class="enterShop">
        进店逛逛
      </div>
    </div>
  </div>
</template>

<script>

  export default {
    props:{
     shopInfo:{
       type:Object,
       default(){
         return {}
       }
     }
    },
    filters:{
      sellCountFilter(value){
        if(value<10000){
          return
        }else if(value>10000){
          return (value/10000).toFixed(1)
        }
      }
    }
  }
</script>

<style scoped>
  .shopInfo{
    padding:25px 8px;
    border-bottom:5px solid #f2f5f8;
  }
  .shop-top{
    display:flex;
    align-items:center;
    line-height: 45px;;
  }
  .shop-top img{
    width:45px;
    height:45px;
    border-radius:50%;
    border: 1px solid rgba(0,0,0,.1);
    vertical-align: middle;
  }
  .shop-top span{
    margin-left: 10px;

  }
  .shop-middle{
    margin-top:15px;
    display:flex;
    text-align:center;
    align-items:center;
  }
  .shop-middle-item{
    flex:1;
  }
  .shop-middle-left {
    display:flex;
    justify-content: space-around;
    align-items:baseline;
    color:#333;
    border-right: 1px solid rgba(0,0,0,.1)
  }
  .sells-count, .goods-count {
      font-size: 18px;
    }

  .sells-text, .goods-text {
      margin-top: 10px;
      font-size: 12px;
  }
  .service{
    display:grid;
    grid-template-rows:repeat(3,1fr);
    font-size:13px;
    margin-left:30px;
    color:#333;
  }
  .service .service-item{
    display:grid;
    grid-template-columns: 2fr 1fr 1fr;
    justify-items:center;
    align-items:baseline;

  }
  .service-item .item{
    padding:5px 0;
  }
  .service-item .better, .service-item .score{
    color:#5ea732;
  }
  .good{
    color:#f13e3a !important;
  }
  .shop-bottom{
    text-align:center;
    margin-top:10px
  }
  .enterShop{
    display:inline-block;
    width:150px;
    height:30px;
    line-height: 30px;
    text-align:center;
    border-radius:10px;
    background-color: #f2f5f8;
    font-size: 14px;
  }
</style>
